//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.uiotsoft.util.encrypt;

import java.util.Locale;

public class DataTypeSwitch {
    public DataTypeSwitch() {
    }

    public static String hexStr2Str(String hexStr) {
        char[] mChars = "0123456789ABCDEF".toCharArray();
        String mHexStr = "0123456789ABCDEF";
        hexStr = hexStr.trim().replace(" ", "").toUpperCase(Locale.US);
        char[] hexs = hexStr.toCharArray();
        byte[] bytes = new byte[hexStr.length() / 2];
        for(int i = 0; i < bytes.length; ++i) {
            int iTmp = mHexStr.indexOf(hexs[2 * i]) << 4;
            iTmp |= mHexStr.indexOf(hexs[2 * i + 1]);
            bytes[i] = (byte)(iTmp & 255);
        }

        return new String(bytes);
    }

    public static byte[] intToByte(int i) {
        byte[] bt = new byte[]{(byte)(255 & i), (byte)(('\uff00' & i) >> 8), (byte)((16711680 & i) >> 16), (byte)((-16777216 & i) >> 24)};
        return bt;
    }

    public static int bytesToInt(byte[] bytes) {
        int num = bytes[0] & 255;
        num |= bytes[1] << 8 & '\uff00';
        num |= bytes[2] << 16 & 16711680;
        num |= bytes[3] << 24 & -16777216;
        return num;
    }
}
